<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php 
if(isset($_POST['q'])){$q=$_POST['q'];} else { echo "<script language=\"javascript\">alert (\"pls insert a question\"); location.href=\"bonus.php\";</script>"; die();}
if(isset($_POST['o1'])){$o1=$_POST['o1'];} else { echo "<script language=\"javascript\">alert (\"pls insert option 1\"); location.href=\"bonus.php\";</script>"; die();}

include("sql.php");

$query2= "select max(qno) from bonus;";
	$result2=mysql_query($query2);
	if (!mysql_query($query2))
  {
  die('Error: ' . mysql_error());
  } 
	$row = mysql_fetch_array($result2);
	$qno=++$row[0];

$q=addslashes($q);
$o1=addslashes($o1);


$query="insert into bonus values(\"$qno\",\"$q\",\"$o1\");";

if (!mysql_query($query))
  {
  die('Error: ' . mysql_error());
  } 
  echo "<script language=\"javascript\">alert (\"question registration sucessfull\"); location.href=\"bonus.php\";</script>";

  
  ?>


</body>
</html>
